<?php
/**
 * Created by PhpStorm.
 * User: zhang-hong
 * Date: 2017/3/27
 * Time: 18:21
 */
class DeletetizhengdataController extends Yaf_Controller_Abstract
{
    public function IndexAction()
    {
        $request = $this->getRequest();
        $id = $request->getPost("id","");
        $yiyuan_id = $request->getPost("yiyuan_id","");

        //医院id判断
        if($yiyuan_id === "")
        {
            Utility::apiJsonError(20028, '请输入医院ID');
        }
        elseif(!ctype_digit("$yiyuan_id"))
        {
            Utility::apiJsonError(20027, '医院ID必须是整型');
        }


        if($id === "")
        {
            Utility::apiJsonError(20028, 'ID为空');
        }
        elseif(!ctype_digit("$id"))
        {
            Utility::apiJsonError(20027, 'ID必须是整型');
        }
       // $id = strip_tags($_REQUEST['id']);
        $sql_act = DB::update('zhuyuan_tizheng')
            ->set(array('state'  => 0,"modify_time"=>date('Y-m-d H:i:s',time())))
            ->where('id','=', $id)
            ->and_where('yiyuan_id', '=', $yiyuan_id)
            ->and_where('state', '=', 1)->execute();

        if($sql_act)
        {
            $statr['state'] =1;
        }else{
            $statr['state'] =0;
        }
        $statr['error'] = 200;
        $statr['msg'] = "";
        Utility::apiJsonResultExtends($statr);

    }
}